﻿namespace JsViewEngine.Demo.Controllers
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;

    using JsViewEngine.Demo.Models;

    public class JsRenderDemosController : Controller
    {
        //
        // GET: /JsRenderDemos/

        public ActionResult Index()
        {
            return this.View();
        }

        public ActionResult InsertingDataValues()
        {
            var model = new MoviesViewModel();
            model.Movies.Add(new MoviesViewModel.Movie { name = "The Red Violin", releaseYear = "1998" });
            model.Movies.Add(new MoviesViewModel.Movie { name = "Eyes Wide Shut", releaseYear = "1999" });
            model.Movies.Add(new MoviesViewModel.Movie { name = "The Inheritance", releaseYear = "1976" });

            return View(model);
        }

        public ActionResult NamedTemplates(bool? details = null)
        {
            var model = new MoviesViewModel();
            model.Movies.Add(new MoviesViewModel.Movie { name = "The Red Violin", releaseYear = "1998", director = "François Girard" });
            model.Movies.Add(new MoviesViewModel.Movie { name = "Eyes Wide Shut", releaseYear = "1999", director = "Stanley Kubrick" });
            model.Movies.Add(new MoviesViewModel.Movie { name = "The Inheritance", releaseYear = "1976", director = "Mauro Bolognini" });
            model.ShowDetails = details;

            return this.View(model);
        }

        public ActionResult ConvertersAndEncoding()
        {
            var model = new MoviesViewModel();

            model.Movies.Add(new MoviesViewModel.Movie
                    {
                        name = "Meet Joe Black",
                        synopsis = "The <span class='role'>grim reaper</span> (<a href='http://www.netflix.com/RoleDisplay/Brad_Pitt/73919'>Brad Pitt</a>) visits <span class='role'>Bill Parrish</span> (<a href='http://www.netflix.com/RoleDisplay/Anthony_Hopkins/43014'>Anthony Hopkins</a>)...",
                    });
            model.Movies.Add(new MoviesViewModel.Movie
                    {
                        name = "Eyes Wide Shut",
                        synopsis = "Director <span class='director'>Stanley Kubrick's</span> final film: <br/><br/><img src='http://cdn-4.nflximg.com/US/boxshots/large/5670434.jpg'/>",
                    });

            return this.View(model);
        }
    }
}
